﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace ProjBackEnd.Models
{
    public class BaseResponseInfo
    {
        public BaseResponseInfo()
        {
            result = new BaseResultInfo();
        }

        [Required]
        public BaseResultInfo result { get; set; }

        /// <summary>
        /// 状态码
        /// </summary>
        [Required]
        public int statusCode { get; set; }
        /// <summary>
        /// 应答状态码
        /// </summary>
        [Required]
        public string statusMsg { get; set; } = "";
    }

    /// <summary>
    /// 基础应答信息（泛型）
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class BaseResponseInfo<T> where T : BaseResultInfo, new()
    {
        public BaseResponseInfo()
        {
            result = new T();
        }

        [Required]
        public T result { get; set; }

        /// <summary>
        /// 状态码
        /// </summary>
        [Required]
        public int statusCode { get; set; }
        /// <summary>
        /// 应答状态码
        /// </summary>
        [Required]
        public string statusMsg { get; set; } = "";
    }

    /// <summary>
    /// 基础结果集信息
    /// </summary>
    public class BaseResultInfo
    {
        public BaseResultInfo() { }
    }

    /// <summary>
    /// 分页结果集信息
    /// </summary>
    public class BaseResultInfoPaging : BaseResultInfo
    {

        /// <summary>
        /// 是否有下一页
        /// </summary>
        [Required]
        public bool hasnextpage { get; set; } = false;

        /// <summary>
        /// 页数合计
        /// </summary>
        [Required]
        public int pagecount { get; set; }

        /// <summary>
        /// 结果集记录合计
        /// </summary>
        [Required]
        public int reccount { get; set; }

    }

}